<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>合同明细</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="{{asset('layui/css/layui.css')}}" media="all">
    <link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css">
    <script type="text/javascript" src="{{asset('Jquery/jquery-3.3.1.js')}}"></script>
    <script src="{{asset('layui/layui.js')}}"></script>
    <script src="/comment/comment.js"></script>
    <script src="/comment/jquery.html5-fileupload.js"></script>
</head>

<body>
<style>
    #item th {
        color: black;
        text-align: center;
    }

    #content th {
        color: #16181b;
        text-align: center;
    }
</style>
<div class="layui-form" id="movieList">
    <form action="{{Route('contract.detail')}}" method="get" id="data">
        <table class="layui-table">
            <thead>
            <tr>
                <th colspan="31" style="color:#666666;font-size: 18px;text-align: center"> 合同明细</th>
            </tr>
            <tr>

            </tr>
            <tr>
                <th colspan="9">

                    <div class="layui-inline">
                        <select name="project_id" lay-filter="select" id="zone">
                            <option value="">请选择项目</option>
                            @foreach($projects as $project)
                                <option value="{{$project->id}}">{{$project->name}}</option>
                            @endforeach
                        </select>
                    </div>


                    <div class="layui-inline">
                        <select name="levy_house_num" lay-filter="select" id="type">
                            <option value="">请选择房屋编号</option>
                            @foreach($houses as $house)
                                <option value="{{$house->levy_house_num}}">{{$house->levy_house_num}}</option>
                            @endforeach
                        </select>
                    </div>

                    <div class="layui-inline">
                        <input type="text" name="owner" lay-verify="required" placeholder="产权人姓名" autocomplete="off"
                               class="layui-input">
                    </div>


                    <div class="layui-inline">
                        <button class="layui-btn  layui-btn-radius " id="search"><i class="layui-icon layui-icon-search"
                                                                                    style="font-size: 15px; color:black;"></i><b
                                    style="color:white">搜索</b></button>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layui-btn-primary layui-btn-radius layui-btn-warm" id="reset"><i
                                    class="layui-icon layui-icon-set-fill"
                                    style="font-size: 15px; color:dodgerblue;"></i><b style="color:white">重置</b>
                        </button>
                    </div>

                </th>
            </tr>
            </thead>
        </table>
    </form>

    <div class="oldData" id="oldData">
        <table class="layui-table">
            <thead>
            <tr id="item">
                <th>
                    <button class="layui-btn layui-btn-xs ">序号</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">房屋编号</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs">产权人</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs">联系电话</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs">补偿方式</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs">补偿地址</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs">还建面积</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">补偿金额</button>
                </th>


                <th>
                    <button class="layui-btn layui-btn-xs ">房屋价值补偿(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">未经登记价值补偿(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">装修补偿(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">临时安置补偿(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">搬迁补偿(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">房屋附属设施补偿(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">水表补偿(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">电表补偿(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">有线电视补偿(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">空调补偿费(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">空调补偿费(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">电热水器补偿(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">构筑物补偿(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">建筑面积补助(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">产权调换补助(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">生活困难补助(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">签约搬迁奖励(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">经营性补助(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">“住改商”(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">可产权调换的面积(¥)</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">应补（收）金额(¥)</button>
                </th>





                <th>
                    <button class="layui-btn layui-btn-xs ">是否签订合同</button>
                </th>
                <th>
                    <button class="layui-btn layui-btn-xs ">操作</button>
                </th>
            </tr>
            </thead>
            <tbody>
            @foreach($contract_details as $k=>$contract_detail)
                @if($contract_detail->houses)
                    <tr id="content" data-id="{{$contract_detail->id}}">
                        <th>
                            <button class="layui-btn layui-btn-xs layui-bg-cyan">{{$k+1}}</button>
                        </th>

                        <th>{{$contract_detail->houses->levy_house_num}}</th>
                        <th>{{$contract_detail->houses->owner}}</th>
                        <th>{{$contract_detail->houses->phone}}</th>
                        <th>{{$contract_detail->repay_type}}</th>
                        <th>{{$contract_detail->repay_house_address}}</th>
                        <th>{{$contract_detail->repay_built_area}}</th>
                        <th>{{$contract_detail->repay_money}}</th>



                        <th>@if($contract_detail->details){{$contract_detail->details->house_money}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->unregistered_money}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->decorate_money}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->resettlement_money}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->removal_money}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->house_facilities_money}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->water_meter_money}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->electric_mete_money}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->cable_tv_money}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->air_conditioning_money}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->solar_water_heater}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->electric_water_heater}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->structures_money}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->built_area_money}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->equity_replace_money}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->life_money}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->remova_reward}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->operational_money}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->housing_to_business}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->equity_replace_area}}@endif</th>
                        <th>@if($contract_detail->details){{$contract_detail->details->receivable_money}}@endif</th>


                        @if($contract_detail->is_sign == 1)
                            <th>
                                <div class="layui-form-item">
                                    <div class="layui-input-block">
                                        <input type="checkbox" name="is_sign" lay-skin="switch" lay-text="是" checked
                                               disabled>
                                    </div>
                                </div>
                            </th>

                            @if($contract_detail->contract_img != '')
                            <th>
                                <span class="layui-btn layui-btn-sm layui-btn-radius show_img">查看合同图片</span>
                            </th>
                            @else
                                <th>
                                    <span class="layui-btn layui-btn-sm layui-btn-radius layui-btn-disabled">查看合同图片</span>
                                </th>
                            @endif

                        @else
                            <th class="change_on">
                                <div class="layui-form-item">
                                    <div class="layui-input-block">
                                        <input type="checkbox" name="is_sign" lay-skin="switch" lay-text="否" checked
                                               disabled>
                                    </div>
                                </div>
                            </th>
                        @endif
                    </tr>
                @endif
            @endforeach
            <tr>
                <th colspan="31" style="text-align: left;color: darkorange">{{$contract_details->links()}}</th>
            </tr>
            </tbody>
        </table>

    </div>
</div>
</body>


<script>
    layui.use('form', function () {
        var form = layui.form;
    });



    // 查看合同图片
    $(".show_img").click(function () {
        var id = $(this).parents('tr').data('id');

        $.post('/contract/show_img', {id: id}, function (json) {
            console.log(json);
            layui.use('layer', function () {
                layer.photos({
                    photos: json

                    , anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
                });
            });

        });
    });











</script>


</html>